fork download
  1. /* output a single-digit pseudo-random number 0 to 9 */
  2. #include <stdio.h>
  3. #include <time.h>
  4.  
  5. int main(void) {
  6. srand(time(NULL));
  7. int r, s;
  8. int k;
  9.  
  10. for (k = 0; k < 5; k++){
  11. r = rand();
  12. s = r - ((r / 10) * 10);
  13.  
  14. printf("%d\n%d\n", r, s);
  15. }
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
1134877677
7
1094379526
6
426635718
8
1215685198
8
795535967
7